﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace A1
{
    /// <summary>
    /// The game over menu
    /// </summary>
    class GameOverMenu
    {
        private string message; // The message to display
        private Vector2 vector; // The location of the message
        private SpriteFont font; // The font

        /// <summary>
        /// Create a new game over screen
        /// </summary>
        /// <param name="winner">The winner of the game (based off position) 1=R in this order: R,L,T,B,CPU</param>
        /// <param name="font">The game font</param>
        public GameOverMenu(int winner, SpriteFont font)
        {
            this.font = font;
            vector = new Vector2(275, 275);
            switch (winner)
            {
                case 1:
                    message = "Right Wins!";
                    break;
                case 2:
                    message = "Left Wins!";
                    break;
                case 3:
                    message = "Top Wins!";
                    break;
                case 4:
                    message = "Bottom Wins!";
                    break;
                default:
                    message = "CPU Wins!";
                    break;
            }
        }

        public Game1.GameState Update(InputManager input)
        {
            if (input.ButtonReady(Buttons.Start, 0) || input.KeyReady(Keys.Enter))
            {
                return Game1.GameState.Main;
            }
            return Game1.GameState.GameOver;
        }

        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.DrawString(font, message, vector, Color.White);
            spriteBatch.DrawString(font, "Press enter or start to go to the main menu", new Vector2(50, 350), Color.White);
        }
    }
}
